//验证订单--根据消费码查询订单
exports.search_order_by_consume = function (req, res) {

    var restfulParams = req.routeInfo.restfulParams;
    //最终结果
    var resultData = {};
    //任务流创建
    async.waterfall([
            function (cb) {
                R.SEND_HTTP(
                    req,
                    {
                        url: CORE_APIConfig.coreAPI.search_consume + "/cn_number/" + restfulParams.cn_number+"/cn_oid/"+restfulParams.oid,
                        method: 'POST',
                        data: {
                            fields: ["cn_status", "cn_ono"].join(",")
                        }
                    },
                    function (err, data) {
                        //判断是否有错误信息
                        if (err) {
                            return cb(err, data);
                        }
                        resultData.consumeData = data.data;
                        cb();
                    }
                );

            },
            function (cb) {

                if (resultData.consumeData.length > 0) {
                    R.SEND_HTTP(
                        req,
                        {
                            url: CORE_APIConfig.coreAPI.search_user_order + "/o_no/" + resultData.consumeData[0].cn_ono,
                            method: 'POST',
                            data: {
                                fields: ["o_phone", "o_name", "u_header_url", "o_course_name"].join(",")
                            }
                        },
                        function (err, data) {
                            //判断是否有错误信息
                            if (err) {
                                return cb(err, data);
                            }
                            resultData.orderData = data.data;
                            cb();
                        }
                    );
                }else{
                    cb();
                }
            }
        ], function (err, result) {

            //返回最终拼接结果
            RES.response(res, true, resultData);

        }
    );

}